package ukafka

import "code.bydev.io/frameworks/byone/kafka"

type ProducerConfig struct {
	KycKafKaNotAuthed kafka.ClientConfig
}

type ProducerClient struct {
	KYCResult      kafka.Producer
	FilecoreUpload kafka.Producer
}

const (
	KYCResultKafkaTopicDefault = "user_kyc_notify_topic"
	FilecoreUploadKafkaTopic   = "cht.kyc.file.upload-filecore"
)

func NewKafka(pc *ProducerConfig) *ProducerClient {
	return &ProducerClient{
		KYCResult: kafka.MustNewProducer(kafka.ProducerConfig{
			Client:               pc.KycKafKaNotAuthed,
			Topic:                KYCResultKafkaTopicDefault,
			SharedProducerConfig: kafka.SharedProducerConfig{RequiredAcks: "all"},
		}),
		FilecoreUpload: kafka.MustNewProducer(kafka.ProducerConfig{
			Client:               pc.KycKafKaNotAuthed,
			Topic:                FilecoreUploadKafkaTopic,
			SharedProducerConfig: kafka.SharedProducerConfig{RequiredAcks: "all"},
		}),
	}
}
